
def hex2bin(in_file, out_file):
    def read_file():
        with open(in_file,'r') as fp:
            while True:
                s=fp.readline()
                if s == '':
                    return
                d=int(s,base=16)
                yield d
    with open(out_file,'wb') as fp:
        for i in read_file():
            fp.write(bytearray([i]))


def main(args):
    hex2bin(args[1],args[2])
    return 0
if __name__ == '__main__':
    import sys
    sys.exit(main(sys.argv))
